diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-25 10:01:59 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-02-25 10:01:59 +0700 |
| commit | 51beb18b3709be2b798b7c14352c4aafccd20ed2 (patch) | |
| tree | 7db279af6b656745363cba8ad0b33f9472368816 /src/pages/searchkey/[slug].jsx | |
| parent | 59f1eeb9cb59c8ad3ae2a02a0682d8f01e0bf3b3 (diff) | |
<Miqdad> when numfound = 0 redirect to 404 searchkey
Diffstat (limited to 'src/pages/searchkey/[slug].jsx')
| -rw-r--r-- | src/pages/searchkey/[slug].jsx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pages/searchkey/[slug].jsx b/src/pages/searchkey/[slug].jsx index fbe72dae..06c7252b 100644 --- a/src/pages/searchkey/[slug].jsx +++ b/src/pages/searchkey/[slug].jsx @@ -38,6 +38,11 @@ export default function KeywordPage() { setResult(res?.data?.response?.docs?.[0] || null); } catch (e) { + if (e.response?.status === 404) { + route.replace('/404'); // 🔥 redirect ke 404 + return; + } + console.error('Fetching searchkey failed:', e); } }; |
